<h1>Listing projects</h1>

<table>
  <tr>
    <th>Project reference</th>
    <th>Project number</th>
    <th>State</th>
  </tr>

<% @projects.each do |project| %>
  <tr>
    <td><%=h project.project_reference %></td>
    <td><%=h project.project_number %></td>
    <td>
    <% if project.state==1 %>
    		 Preview
    <% elsif project.state==2 %>
    		 Open
    <% elsif project.state==3 %>
    		 Closed
  	<% end %>
  	</td>
    <td><%= link_to 'Show', project %></td>
    <td><%= link_to 'Edit', edit_project_path(project) %></td>
    <td><%= link_to 'Add tasks', :controller => "projects", :action => "add_tasks",:id => project %></td>
    <td><%= link_to 'Show tasks', :controller => "projects", :action => "show_tasks",:id => project %></td>
    <td><%= link_to 'Destroy', project, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New project', new_project_path %>